import type {
  GetCodeParams,
  GetCodeRes,
  GetUnreadMessageRes,
  PostLoginParams,
  PostLoginPasswordParams,
  PostLoginRes,
} from '@/types/common'
import { request, service } from '@/utils/request'
import type { HttpRequestConfig } from 'luch-request'

/**
 * 登录--密码登录
 */
export const loginPasswordAPI = (params: PostLoginPasswordParams) =>
  request<PostLoginRes>('/login/password', 'POST', params)

/**
 * 获取手机验证码
 */
export const getCodeAPI = (params: GetCodeParams, config?: HttpRequestConfig) =>
  request<GetCodeRes>('/code', 'GET', params, config)

/**
 * 登录--手机验证码登录
 */
export const loginMobileAPI = (params: PostLoginParams) =>
  request<PostLoginRes>('/login', 'POST', params)

/**
 * 消息通知 - 未读消息数量
 */
export const getUnreadMessageCountAPI = () =>
  request<GetUnreadMessageRes>('/patient/message/unRead/all')

/**
 * 上传文件
 */
export const uploadFileAPI = (filePath: string) =>
  request<{ url: string; id: string }>('/upload', 'UPLOAD', {}, { name: 'file', filePath })
